package net.zjitc.controller;

import net.zjitc.common.ResponseResult;
import net.zjitc.exception.ReportsException;
import net.zjitc.service.ReportsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
public class ReportsController {
    @Autowired
    private ReportsService reportsService;

    @GetMapping("reports/type/1")
    public ResponseResult reportsOne() {
        ResponseResult result = new ResponseResult();
        try {
            result = reportsService.reportsOne();
        }catch (ReportsException e) {
            result.setError(e.getMessage());
        }
        return result;
    }
}

